<div class="admin">
<div class="tab panel dux-box admin-panel">
    <div class="panel-head"><strong>添加满减送</strong></div>
            <div class="fixed-empty"></div>
            <form id="myform" name="myform" method="post" action="">
                <table class="table tb-type2">
                    <tbody>
                        <tr>
                            <td width="10%" class="required"><label class="validation" for="title">活动标题:</label></td>
                            <td width="30%" class="vatop rowform"><input type="text" class="form-control" value="" datatype="*" name="title" size="60" /></td>
                            <td class="vatop tips"></td>
                        </tr>
                        <tr>
                            <td class="required"><label class="validation" for="start_time">开始日期:</label></td>
                            <td class="vatop rowform"><input type="text" class="input input_small" readonly="readonly" datatype="*" value="" id="query_start_time" name="start_time"></td>
                            <td class="vatop tips"></td>
                        </tr>
                        <tr>
                            <td class="required"><label class="validation" for="end_time">结束日期:</label></td>
                            <td class="vatop rowform"><input type="text" class="input input_small" readonly="readonly" datatype="*" value="" id="query_end_time" name="end_time"></td>
                            <td class="vatop tips"></td>
                        </tr>
                        <tr>
                            <td class="required"><label class="validation" for="">规则:</label></td>
                            <td class="vatop rowform">
                                <div class="attr">
                                    <div class="ncsc-mansong-rule">
                                        <span >单笔订单满&nbsp;<input name="mansong_price[]" class="inputL input_smallL" type="text"><em class="add-on">元</em>，</span>
                                        <span>立减现金&nbsp;<input name="mansong_discount[]" class="inputL input_smallL" type="text"><em class="add-on">元</em></span>
                                    </div>
                                </div>
                                <span id="addattr" class="button bg-blue"><i class="icon-plus"></i> 添加规则</span>
                                <span id="reduceattr" class="button bg-blue"><i class="icon-minus"></i> 减少规则</span>
                            </td>
                            <td class="vatop tips"></td>
                        </tr>
                        <tr>
                            <td class="required"><label class="validation" for="remark">描述:</label></td>
                            <td class="vatop rowform"><textarea class="form-control" name="remark" id="remark" cols="62" rows="3"></textarea></td>
                            <td class="vatop tips"></td>
                        </tr>
                    </tbody>
                    <tfoot>
                        <tr>
                            <td colspan="3"><input class="button bg-main" type="submit" value="提交"></td>
                        </tr>
                    </tfoot>
                </table>
            </form>
        </div>
		</div>
        <script type="text/javascript">
            $('#myform').layer({});
            $('#query_start_time').duxTime({
                minDate: 0,
                format:"Y-m-d H:i"
            });
            $('#query_end_time').duxTime({
                minDate: 0,
                format:"Y-m-d H:i"
            });

            var htmla = '<div class="ncsc-mansong-rule"><span >单笔订单满&nbsp;<input name="mansong_price[]" class="inputL input_smallL" type="text"><em class="add-on">元</em>，</span><span>立减现金&nbsp;<input name="mansong_discount[]" class="inputL input_smallL" type="text"><em class="add-on">元</em></span></div>';
            $("#addattr").click(function () {
                var num = $(".ncsc-mansong-rule").length;
                if (num <= 4) {
                    $(".attr").append(htmla);
                } else {
                    layer.msg('一次性优惠最多添加五个！！！');
                }
            });
            //减少商品属性  规格
            $("#reduceattr").click(function () {
                var num = $(".ncsc-mansong-rule").length;
                if (num != 1) {
                    $(".attr div:last-child").remove();
                } else {
                    layer.msg('优惠规则至少一个！！！');
                }
            });

        </script>
